import instance from '../utils/request'
// import axios from 'axios'

//调用模型进行识别
export const recognitionService = (file) => {

    const formData = new FormData();
    formData.append('file', file);

    return instance.post('/recognize-audio', formData)
}

//上传模型
export const uploadModelService = (file) => {

    const formData = new FormData();
    formData.append('file', file);

    return instance.post('/upload-model', formData)
}

//保存鸟类音频文件到数据集文件夹中
export const saveAudioService = (file,birdNumber) => {

    //输出来看一下
    console.log(file)
    console.log(birdNumber)

    const formData = new FormData();
    formData.append('file', file);
    formData.append('birdNumber', birdNumber);

    return instance.post('/save-audio', formData)

}

//开启提取特征任务
export const extractFeatureService = () => {

    return instance.post('/extract-features', null)

}

//查询特征提取任务结果（状态）
export const getFeatureExtractionResultService = (taskId) => {

    const param = new URLSearchParams();
   
    param.append("taskId",taskId)

    return instance.post('/extract-features/result', param)

}

// 结束特征提取任务
export const stopFeatureExtractionService = (taskId) => {

    const param = new URLSearchParams();
   
    param.append("taskId",taskId)

    return instance.post('/extract-features/stop', param)

}

//复制npy文件，用新的训练集替换原来的训练集
export const copyMfccService = () => {

    return instance.post('/copy_MFCC', null)

}